package com.cloudconsumerfeign.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.cloud.api.commons.pojo.CommonResult;
import com.cloud.api.commons.pojo.Payment;
import com.cloudconsumerfeign.service.PaymentService;

import lombok.extern.slf4j.Slf4j;

@SuppressWarnings(value={"rawtypes", "unchecked"})
@RestController
@Slf4j
public class OrderFeignController {
	
	@Autowired
	private PaymentService paymentService;

	@GetMapping("/consumer/payment/get/{id}")
	public CommonResult<Payment> getPaymentById(@PathVariable("id") String id) {
		CommonResult result = paymentService.queryById(id);
		log.info("查询结果CommonResult:{}", result);
		return result;
	}
	
	/**
	 * 测试超时接口
	 * @return
	 * @throws InterruptedException
	 */
	@GetMapping("/consumer/feign/timeout")
    public String PaymentFeignTimeOut() throws InterruptedException{
        return paymentService.PaymentFeignTimeOut();
    }

}